<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePetsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pets', function (Blueprint $table) {
            $table->id();
            $table->string('name', 32)->default('')->comment('姓名');
            $table->integer('cid')->default(0)->comment('种类ID');
            $table->integer('scid')->default(0)->comment('亚种ID');
            $table->integer('mid')->default(0)->comment('主人ID');
            $table->timestamp('birthday')->comment('生日');
            $table->string('avatar', 256)->default('')->comment('头像');
            $table->string('id_no', 32)->default('')->comment('身份证号');
            $table->integer('province')->default(0)->comment('省份');
            $table->integer('city')->default(0)->comment('市');
            $table->integer('area')->default(0)->comment('区县');
            $table->string('address_info', 128)->default('')->comment('家庭住址详情');
            $table->tinyInteger('status')->default(0)->comment('状态');
            $table->timestamps();
            $table->index('name');
            $table->index('cid');
            $table->index('scid');
            $table->index('id_no');
        });
        DB::statement("ALTER TABLE `pets` comment '宠物表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('pets');
    }
}
